﻿	<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
	<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
	
	<script type="text/javascript">
		var newGoodsTypeCallback = function () {$('#dlg-goodsType #fm-goodsType #text').focus();}
		
		var expand = true;
		function toggleAll(treeId) 
		{
			if(expand) 
			{
				collapseAll(treeId);
				expand = false;
				$('#panel-goodsType #gt-toggleAll').html('<span class="l-btn-left l-btn-icon-left"><span class="l-btn-text"><spring:message code="expandAll" /></span><span class="l-btn-icon datagrid-row-expand">&nbsp;</span></span>');
			}
			else 
			{
				expandAll(treeId);
				expand = true;
				$('#panel-goodsType #gt-toggleAll').html('<span class="l-btn-left l-btn-icon-left"><span class="l-btn-text"><spring:message code="collapseAll" /></span><span class="l-btn-icon datagrid-row-collapse">&nbsp;</span></span>');
			}
		}
	</script>
	
	<div id="panel-goodsType" class="" title="" style="width:500px; height:400px; padding:2px 10px 10px 2px;">
		<div id="toolbar-goodsType" style="width: 100%; background-color: #F4F4F4">
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-add" plain="true" onclick="newRootTreeNode('#dlg-goodsType', '<spring:message code="newRootType" />', '<c:url value='/goodsType/newGoodsType.html' />', newGoodsTypeCallback)" title="<spring:message code="newRootType" />"><spring:message code="newRootType" /></a>
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-remove" plain="true" onclick="removeMultipleFromTree('#panel-goodsType #tt_goodsType', '<c:url value='/goodsType/delGoodsType.html' />')" title="<spring:message code="checkOneOrMultiple" /><spring:message code="removeType" />"><spring:message code="removeType" /></a>
			<a id="gt-toggleAll" href="javascript:void(0)" class="easyui-linkbutton" iconCls="datagrid-row-collapse" plain="true" onclick="toggleAll('#panel-goodsType #tt_goodsType')"><spring:message code="collapseAll" /></a>
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-reload" plain="true" onclick="loadTreeData ('#panel-goodsType #tt_goodsType', '<c:url value='/goodsType/asyncGetGoodsType.html' />')" title="<spring:message code="refresh" />"><spring:message code="refresh" /></a>
		</div>
		<ul id="tt_goodsType" style="width:478px; height: 92%" class="easyui-tree" data-options="
			url: '<c:url value='/goodsType/asyncGetGoodsType.html' />',
			animate: true,
			checkbox: true,
			onContextMenu: function(e,node) {
				e.preventDefault();
				$(this).tree('select',node.target);
				$('#mm_goodsType').menu('show',{
					left: e.pageX,
					top: e.pageY
				});
			},
			formatter:function(node){
				var s = node.text;
				if (node.children && node.children.length > 0){
					s += '&nbsp;<span style=\'color:blue\'>(' + node.children.length + ')</span>';
				}
				return s;
			}
		">
		</ul>
	</div>
    <div id="mm_goodsType" class="easyui-menu" style="width:120px;">
        <div onclick="newRootTreeNode('#dlg-goodsType', '<spring:message code="newRootType" />', '<c:url value='/goodsType/newGoodsType.html' />', 						newGoodsTypeCallback)" data-options="iconCls:'icon-add'">
			<spring:message code="newRootType" />
		</div>
        <div onclick="appendToTree('#panel-goodsType #tt_goodsType', '#fm-goodsType #parentId', '#dlg-goodsType', '<spring:message code="appendType" />', 
			'<c:url value='/goodsType/newGoodsType.html' />', newGoodsTypeCallback)" data-options="iconCls:'icon-add'">
			<spring:message code="appendType" />
		</div>
        <div onclick="editTree('#panel-goodsType #tt_goodsType', '#fm-goodsType #parentId', '#fm-goodsType #goodsTypeId', 
			'#fm-goodsType #text', '#dlg-goodsType', '<spring:message code="editType" />', '<c:url value='/goodsType/updateGoodsType.html' />', newGoodsTypeCallback)" data-options="iconCls:'icon-edit'">
			<spring:message code="editType" />
		</div>
        <div onclick="removeFromTree('#panel-goodsType #tt_goodsType', '<c:url value='/goodsType/delGoodsType.html' />')" 
			data-options="iconCls:'icon-remove'">
			<spring:message code="removeType" />
		</div>
        <div class="menu-sep"></div>
        <div onclick="expandTree('#panel-goodsType #tt_goodsType')"><spring:message code="expand" /></div>
        <div onclick="collapseTree('#panel-goodsType #tt_goodsType')"><spring:message code="collapse" /></div>
    </div>

	<div id="dlg-goodsType" class="easyui-dialog"
		style="width: 400px; height: 300px; padding: 10px 20px" closed="true"
		buttons="#dlg-buttons-goodsType" data-options="modal:true">
		<div class="ftitle"><spring:message code="goodsType" /></div>
		<form id="fm-goodsType" class="fm" method="post" novalidate>
			<div class="fitem divHidden">
				<input id="parentId" name="parentId" class="easyui-validatebox" readonly="readonly" />
			</div>
			<div class="fitem divHidden">
				<input id="goodsTypeId" name="id" value="0" />
			</div>
			<div class="fitem">
				<label><spring:message code="name" />:</label> 
				<input id="text" name="text" class="easyui-validatebox" required="true" 
				validType="myRemote['<c:url value='/goodsType/checkExist.html' />', 'name', '#goodsTypeId']" 
				onkeyup="if(event.keyCode == 13) {$('#dlg-buttons-goodsType #save-goodsType').click()}" />
			</div>
		</form>
	</div>
	<div id="dlg-buttons-goodsType">
		<a id="save-goodsType" href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-ok" onclick="saveTree('#panel-goodsType #tt_goodsType', '#fm-goodsType', '#dlg-goodsType')"><spring:message code="save" /></a> 
		<a href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-cancel" onclick="javascript:$('#dlg-goodsType').dialog('close')"><spring:message code="cancel" /></a>
	</div>
